package com.futures.investm.activity;

import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.futures.investm.R;
import com.futures.investm.constant.Api;
import com.aries.ui.view.title.TitleBarView;

import tech.com.commoncore.base.BaseTitleActivity;


public class ArticleDetailsActivity extends BaseTitleActivity {

    private android.webkit.WebView mWebview;

    String strId = "";

    @Override
    public void setTitleBar(TitleBarView titleBar) {
        titleBar.setTitleMainText("百科详情");
    }

    @Override
    public int getContentLayout() {
        return R.layout.activity_article_details;
    }

    @Override
    public void initView(Bundle savedInstanceState) {

        strId = (String) getIntent().getSerializableExtra("id");

        mWebview = (WebView) findViewById(R.id.webview);
        WebSettings webSettings = mWebview.getSettings();
        //设置WebView属性，能够执行Javascript脚本
        webSettings.setJavaScriptEnabled(true);
        //设置可以访问文件
        webSettings.setAllowFileAccess(true);
        //设置支持缩放
        webSettings.setBuiltInZoomControls(true);
        webSettings.setDisplayZoomControls(true);
        //设置Web视图
        mWebview.setWebViewClient(new MyWebViewClient());

        mWebview.loadUrl(Api.BASE_URL + Api.WEB_URL + strId);


    }
    //Web视图
    private class MyWebViewClient extends WebViewClient {
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            view.loadUrl(url);
            return true;
        }
    }
}
